package ThreadTest;
import java.util.Scanner;

public class Dome19 {
    private volatile static int count = 0;
    public static void main(String[] args)throws InterruptedException{

        Thread t = new Thread(() ->{
            while(count == 0) {
                System.out.println("输入任意不等于0的数字结束程序。");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("t执行结束");
        });
        Thread t1 = new Thread(() ->{
            Scanner scanner = new Scanner(System.in);
            while(count ==0) {
                System.out.println("请输入一个整数:");
                count = scanner.nextInt();
            }
        });
        t.start();
        t1.start();
    }
}
